 var app = angular.module('share',['myhead']);
		app.config(function($interpolateProvider) {
		  $interpolateProvider.startSymbol('[[');
		  $interpolateProvider.endSymbol(']]');
		});
		app.run(function ($rootScope) {
			$rootScope.page="dog";
		});
		app.factory('app2fac',function () {
			return {
				say:function (name) {
				alert('her name is '+name);
			     }}
		});
		
		app.directive("leftNavi",function () {
			return {
			     restrict: 'A',
			     replace: true,
			     scope: {
			       items: '=',
			       //click:'&' click='say(name)' click({name:item.link})
			     },
			     template:"<div><div hello></div>"
					 +"<ui><li ng-repeat='item in items' ><a href='' ng-click='item.link(item.name)' >[[item.name]]</a></li></ui>"
			     +"</div>",
		     }
		});
		app.directive('hello',function () {
			
			return {
				transclude: true,
				restrict:'A',
				replace:false,
				template:'<div>hello</div>',
				link: function(scope,iElem, iAttrs){
					alert('here'+JSON.stringify(iAttrs));
					alert('aa='+JSON.stringify( scope.$eval(iAttrs.aa)) );
				}
			}
		})
		app.directive('bigTable',function () {
			return {
				restrict:'A',
				replace:false,
				scope:{
					items:'=',
					heads:'=',
				},
				template:'<div> \
<table class="table table-hover">\
<tr><th ng-repeat="head in heads">[[head]]</th></tr>\
<tr ng-repeat="item in items"><td ng-repeat="data in item">[[data]]</td><tr>\
</table>\
				</div>',
			}
		});

		app.directive('myform',function () {
			
			return {
				
				restrict:'A',
				replace:true,
				scope:{
					items:'='
				},
				template:'<form name="myform" novalidate>'
				        +'<div ng-repeat="item in items" class="form-group linespace">'
				        +'<label class="col-md-3" for="[[item.name]]">[[item.label]]</label>'
				        +'<input ng-class="{\'col-md-9\': item.type!=\'radio\'}" style="text-align:left" type="[[item.type]]" name="[[item.name]]"/>'
				        +'</div>'
				        //+'<button type="submit" class="btn btn-default">提交</button>'
				        +'</form>'
			}
		})
		app.controller('list',['$scope','app2fac',function ($scope,app2fac) {
			$scope.name='heyulin';
			$scope.sayname=function () {
				app2fac.say($scope.name);
			};
			$scope.items=[{name:"dog"},
						{name:"pig"}]
			
		}]);
		
angular.module('myhead',[])
.factory('app2fac',function () {
	return {
		say:function (name) {
		alert('my name is '+name);
	     }}
})
.directive("bootstrap",function () {
			return {
			     restrict: 'E',
			     replace: true,

			     template:'\t<div><!-- 新 Bootstrap 核心 CSS 文件 -->\
		<link rel=\"stylesheet\" href=\"//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css\">\
		<script src=\"//cdn.bootcss.com/jquery/1.11.3/jquery.min.js\"></script>\
		<script src=\"//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>   \
				 </div>'

		     }
		});